package com.longteng.lesson2.domain;

/**
 * Created by taki
 * DATE : 2018/10/28 0028
 * TIME : 22:58
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:165157905@qq.com">taki</a>
 */
public class Person {
    /**
     * 名字属性
     * **/
    private String name;
    /**
     * 年龄属性
     * **/
    private int age;

   public Person(){}

    Person(String name){
        this.name=name;
    }

    Person(String name,int age){
        this.name=name;
        this.age=age;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        System.out.println("我是父类的起名字方法");
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void eat(){
        System.out.println("吃饭");
    }

    public void showInfo(){

    }

    @Override
    public boolean equals(Object obj) {
        final Person person = (Person) obj;
        if (this == person) {
            return true;
        } else {
            return (this.name.equals(person.name) && this.age == person.age);
        }
    }
    @Override
    public int hashCode() {
        return name.hashCode()*37+age;
    }
}
